<?php
$root = $_SERVER['SCRIPT_NAME'];
$request = $_SERVER['REQUEST_URI'];

$URI = array();

$url = trim(str_replace($root, '', $request), '/');

if (empty($url)) {
    $class = 'index';
    $func = 'welcome';
} else {
    $URI = explode('/', $url);
    if (count($URI) < 2) {
        $class = $URI[0];
        $func = 'index';
    } else {
        $class = $URI[0];
        $func = $URI[1];
    }
}
include('./' . $class . '.php');
    
//实例化->将控制器首字母大写  
$obj = ucfirst($class);

$obj = new $obj;
call_user_func_array(
	array($obj, $func),
	array()
);